﻿package andy.demo.getBootUp;

import java.util.Date;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class BootUpReceiver extends BroadcastReceiver{
	private SharedPreferences sharedPreferences;
	private Editor editor;
	@Override
	public void onReceive(Context context, Intent intent) {
		System.out.println(intent.getAction());
		
//		 if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ 
		sharedPreferences = context.getSharedPreferences("bootUp", Context.MODE_PRIVATE);
		editor = sharedPreferences.edit();
		
		editor.putLong("bootUpTime", new Date().getTime());
		
		editor.commit();
		
		context.startActivity(new Intent(context, BootUpActivity.class));
		
			 
			 
//		 }

		
	}

}
